InĀ [1]:
linkWorldMap="https://github.com/CienciaDeDatosEspacial/intro_geodataframe/raw/main/maps/worldMaps.gpkg"


import geopandas as gpd
from  fiona import listlayers
listlayers(linkWorldMap)
Out[1]:
['countries', 'rivers', 'cities', 'indicators']
InĀ [2]:
countries=gpd.read_file(linkWorldMap,layer='countries')
rivers=gpd.read_file(linkWorldMap,layer='rivers')
cities=gpd.read_file(linkWorldMap,layer='cities')
indicators=gpd.read_file(linkWorldMap,layer='indicators')
InĀ [3]:
#Exercise 1
InĀ [4]:
countries.cx[:0,:0]
Out[4]:
COUNTRY geometry
9 American Samoa (US) POLYGON ((-170.74390 -14.37556, -170.74942 -14...
10 Argentina MULTIPOLYGON (((-71.01648 -36.47591, -70.98195...
14 Antarctica MULTIPOLYGON (((-45.14528 -60.76611, -45.15639...
24 Bolivia POLYGON ((-62.19884 -20.47139, -62.26945 -20.5...
29 Brazil MULTIPOLYGON (((-70.62862 -9.94849, -70.62889 ...
42 Chile MULTIPOLYGON (((-73.61806 -51.63390, -73.60494...
47 Colombia MULTIPOLYGON (((-81.71306 12.49028, -81.72014 ...
53 Cook Islands (New Zealand) MULTIPOLYGON (((-165.84167 -10.89084, -165.848...
58 Jarvis Island (US) POLYGON ((-160.02115 -0.39806, -160.02811 -0.3...
60 Ecuador MULTIPOLYGON (((-78.70903 -4.58479, -78.72348 ...
71 Fiji MULTIPOLYGON (((180.00000 -16.17274, 179.98621...
72 Falkland Islands (UK) MULTIPOLYGON (((-59.79139 -51.24945, -59.73195...
75 French Polynesia (France) MULTIPOLYGON (((-140.17783 -8.95639, -140.1894...
158 Niue (New Zealand) POLYGON ((-169.89389 -19.14556, -169.93088 -19...
169 New Zealand MULTIPOLYGON (((177.91779 -38.94280, 177.90970...
170 Paraguay POLYGON ((-57.67267 -25.29430, -57.70639 -25.2...
171 Pitcairn Islands (UK) MULTIPOLYGON (((-128.33221 -24.32727, -128.326...
172 Peru POLYGON ((-69.56750 -10.95056, -69.56844 -10.9...
196 St. Helena (UK) POLYGON ((-5.71298 -15.99286, -5.72917 -16.005...
208 South Georgia and the South Sandwich Is (UK) MULTIPOLYGON (((-36.99139 -54.35056, -36.99973...
216 Tokelau (New Zealand) POLYGON ((-171.84805 -9.21889, -171.85886 -9.2...
217 Tonga MULTIPOLYGON (((-173.93921 -18.56889, -173.933...
231 Uruguay POLYGON ((-58.38889 -33.42250, -58.41590 -33.4...
239 Wallis and Futuna (France) MULTIPOLYGON (((-176.16504 -13.35305, -176.169...
242 Western Samoa MULTIPOLYGON (((-172.59650 -13.50911, -172.551...
InĀ [5]:
argentina=countries[countries.COUNTRY=='Argentina']
InĀ [6]:
citiesArgentina_clipped = gpd.clip(gdf=cities,
                          mask=argentina)
riversArgentina_clipped = gpd.clip(gdf=rivers,
                               mask=argentina)
InĀ [7]:
base = argentina.plot(facecolor="lightblue", edgecolor='black', linewidth=0.4,figsize=(5,5))
No description has been provided for this image
InĀ [8]:
base = argentina.plot(facecolor="lightblue", edgecolor='black', linewidth=0.4,figsize=(5,5))
citiesArgentina_clipped.plot(marker='+', color='red', markersize=15,
                    ax=base)
Out[8]:
<Axes: >
No description has been provided for this image
InĀ [9]:
base = argentina.plot(facecolor="lightblue", edgecolor='black', linewidth=0.4,figsize=(5,5))
riversArgentina_clipped.plot(edgecolor='blue', linewidth=0.5,
                    ax=base)
Out[9]:
<Axes: >
No description has been provided for this image
InĀ [10]:
#Exercise 2
InĀ [11]:
argentina.to_crs(9252).crs.axis_info
Out[11]:
[Axis(name=Northing, abbrev=X, direction=north, unit_auth_code=EPSG, unit_code=9001, unit_name=metre),
 Axis(name=Easting, abbrev=Y, direction=east, unit_auth_code=EPSG, unit_code=9001, unit_name=metre)]
InĀ [12]:
argentina.to_crs(9252).centroid
Out[12]:
10    POINT (2890124.088 6156396.222)
dtype: geometry
InĀ [13]:
base9252=argentina.to_crs(9252).plot()
argentina.to_crs(9252).centroid.plot(color='red',ax=base9252)
Out[13]:
<Axes: >
No description has been provided for this image
InĀ [14]:
argentina_9252=argentina.to_crs(9252)
cities_argentina_9252=citiesArgentina_clipped.to_crs(argentina_9252.crs)
rivers_argentina_9252=riversArgentina_clipped.to_crs(argentina_9252.crs)
InĀ [15]:
base9252=argentina.to_crs(9252).plot()
rivers_argentina_9252.plot(edgecolor='black', linewidth=0.5,ax=base9252)
Out[15]:
<Axes: >
No description has been provided for this image
InĀ [16]:
base9252=argentina.to_crs(9252).plot()
cities_argentina_9252.plot(marker='+', color='red', markersize=15,ax=base9252)
Out[16]:
<Axes: >
No description has been provided for this image
InĀ [17]:
import os

ruta_actual = os.getcwd()
os.mkdir(os.path.join(ruta_actual, "maps"))
print("Carpeta 'maps' creada en la ruta:", ruta_actual)
Carpeta 'maps' creada en la ruta: C:\Users\ASUS
InĀ [18]:
argentina_9252.to_file(os.path.join("maps","argentinaMaps_9252.gpkg"), layer='country', driver="GPKG")
cities_argentina_9252.to_file(os.path.join("maps","argentinaMaps_9252.gpkg"), layer='cities', driver="GPKG")
rivers_argentina_9252.to_file(os.path.join("maps","argentinaMaps_9252.gpkg"), layer='rivers', driver="GPKG")
argentina_9252.centroid.to_file(os.path.join("maps","argentinaMaps_9252.gpkg"), layer='centroid', driver="GPKG")
InĀ [19]:
#Exercise 3
InĀ [20]:
import pandas as pd
infoairports=pd.read_csv('https://github.com/Luis9193/geodf_operations/raw/main/data/ar-airports.csv')

# some rows
infoairports.iloc[[0,1,2,3,-4,-3,-2,-1],:] #head and tail
Out[20]:
id ident type name latitude_deg longitude_deg elevation_ft continent country_name iso_country ... municipality scheduled_service gps_code iata_code local_code home_link wikipedia_link keywords score last_updated
0 #meta +id #meta +code #loc +airport +type #loc +airport +name #geo +lat #geo +lon #geo +elevation +ft #region +continent +code #country +name #country +code +iso2 ... #loc +municipality +name #status +scheduled #loc +airport +code +gps #loc +airport +code +iata #loc +airport +code +local #meta +url +airport #meta +url +wikipedia #meta +keywords #meta +score #date +updated
1 5781 SAEZ large_airport Minister Pistarini International Airport -34.8222 -58.5358 67 SA Argentina AR ... Buenos Aires (Ezeiza) 1 SAEZ EZE EZE http://www.aa2000.com.ar/index.php https://en.wikipedia.org/wiki/Ministro_Pistari... BUE, Ezeiza 1275 2022-10-27T15:05:29+00:00
2 5771 SABE large_airport Jorge Newbery Airpark -34.5592 -58.4156 18 SA Argentina AR ... Buenos Aires 1 SABE AEP AER NaN https://en.wikipedia.org/wiki/Aeroparque_Jorge... NaN 1050 2021-10-07T15:55:36+00:00
3 5835 SAWH medium_airport Malvinas Argentinas Airport -54.8433 -68.2958 102 SA Argentina AR ... Ushuaia 1 SAWH USH USU NaN https://en.wikipedia.org/wiki/Ushuaia_Internat... NaN 750 2021-10-07T11:21:29+00:00
940 42893 AR-0471 heliport Dayry Partners Americas Manufacturing Argentin... -32.44 -63.2289 639 SA Argentina AR ... Villa Nueva 0 NaN NaN HNE NaN NaN NaN 0 2009-10-20T11:13:21+00:00
941 333815 AR-0652 closed Villa Unión Airport -29.42218 -62.789526 248 SA Argentina AR ... Villa Unión 0 NaN NaN NaN NaN NaN NaN 0 2020-04-10T04:01:54+00:00
942 42903 AR-0481 heliport Roca Heliport -32.06 -64.7794 3444 SA Argentina AR ... Yacanto de Calamuchita 0 NaN NaN HYC NaN NaN NaN 0 2009-10-20T11:13:21+00:00
943 42905 AR-0483 heliport Austral S.A. Heliport -52.7386 -68.5725 290 SA Argentina AR ... Yacimiento Cañadón Alfa 0 NaN NaN HCP NaN NaN NaN 0 2021-10-07T11:46:03+00:00

8 rows Ɨ 23 columns

InĀ [21]:
#eliminacion de filas
infoairports.drop(index=0,inplace=True)
infoairports.reset_index(drop=True, inplace=True)
infoairports.head()
Out[21]:
id ident type name latitude_deg longitude_deg elevation_ft continent country_name iso_country ... municipality scheduled_service gps_code iata_code local_code home_link wikipedia_link keywords score last_updated
0 5781 SAEZ large_airport Minister Pistarini International Airport -34.8222 -58.5358 67 SA Argentina AR ... Buenos Aires (Ezeiza) 1 SAEZ EZE EZE http://www.aa2000.com.ar/index.php https://en.wikipedia.org/wiki/Ministro_Pistari... BUE, Ezeiza 1275 2022-10-27T15:05:29+00:00
1 5771 SABE large_airport Jorge Newbery Airpark -34.5592 -58.4156 18 SA Argentina AR ... Buenos Aires 1 SABE AEP AER NaN https://en.wikipedia.org/wiki/Aeroparque_Jorge... NaN 1050 2021-10-07T15:55:36+00:00
2 5835 SAWH medium_airport Malvinas Argentinas Airport -54.8433 -68.2958 102 SA Argentina AR ... Ushuaia 1 SAWH USH USU NaN https://en.wikipedia.org/wiki/Ushuaia_Internat... NaN 750 2021-10-07T11:21:29+00:00
3 5831 SAWC medium_airport El Calafate - Commander Armando Tola Internati... -50.2803 -72.053101 669 SA Argentina AR ... El Calafate 1 SAWC FTE ECA http://www.aeropuertoelcalafate.com/en/ https://en.wikipedia.org/wiki/Comandante_Arman... NaN 500 2022-01-12T18:23:15+00:00
4 5806 SARI medium_airport Cataratas Del Iguazú International Airport -25.737301 -54.4734 916 SA Argentina AR ... Puerto Iguazu 1 SARI IGR IGU http://www.aa2000.com.ar/iguazu https://en.wikipedia.org/wiki/Cataratas_del_Ig... Iguaçu 750 2018-09-13T12:34:47+00:00

5 rows Ɨ 23 columns

InĀ [22]:
infoairports.columns
Out[22]:
Index(['id', 'ident', 'type', 'name', 'latitude_deg', 'longitude_deg',
       'elevation_ft', 'continent', 'country_name', 'iso_country',
       'region_name', 'iso_region', 'local_region', 'municipality',
       'scheduled_service', 'gps_code', 'iata_code', 'local_code', 'home_link',
       'wikipedia_link', 'keywords', 'score', 'last_updated'],
      dtype='object')
InĀ [23]:
keep=['name','type','latitude_deg', 'longitude_deg','elevation_ft','region_name','municipality']
infoairports=infoairports.loc[:,keep]

infoairports.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 943 entries, 0 to 942
Data columns (total 7 columns):
 #   Column         Non-Null Count  Dtype 
---  ------         --------------  ----- 
 0   name           943 non-null    object
 1   type           943 non-null    object
 2   latitude_deg   943 non-null    object
 3   longitude_deg  943 non-null    object
 4   elevation_ft   908 non-null    object
 5   region_name    943 non-null    object
 6   municipality   927 non-null    object
dtypes: object(7)
memory usage: 51.7+ KB
InĀ [24]:
numericCols=['latitude_deg', 'longitude_deg','elevation_ft']
infoairports[numericCols]=infoairports.loc[:,numericCols].apply(lambda x:pd.to_numeric(x))
infoairports.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 943 entries, 0 to 942
Data columns (total 7 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   name           943 non-null    object 
 1   type           943 non-null    object 
 2   latitude_deg   943 non-null    float64
 3   longitude_deg  943 non-null    float64
 4   elevation_ft   908 non-null    float64
 5   region_name    943 non-null    object 
 6   municipality   927 non-null    object 
dtypes: float64(3), object(4)
memory usage: 51.7+ KB
InĀ [25]:
airports=gpd.GeoDataFrame(data=infoairports.copy(),
                 geometry=gpd.points_from_xy(infoairports.longitude_deg,
                                             infoairports.latitude_deg),
                 crs=argentina.crs.to_epsg())

airports_9252=airports.to_crs(9252)

base = argentina_9252.plot(color='white', edgecolor='black')
airports_9252.plot(ax=base)
Out[25]:
<Axes: >
No description has been provided for this image
InĀ [26]:
airports_9252['type'].value_counts()
Out[26]:
type
small_airport     687
heliport          144
medium_airport     68
closed             41
large_airport       2
balloonport         1
Name: count, dtype: int64
InĀ [27]:
airports_9252.rename(columns={'type':'kind'},inplace=True)
airports_9252.to_file(os.path.join("maps","argentinaMaps_9252.gpkg"), layer='airports', driver="GPKG")
InĀ [28]:
#Exercise 4
InĀ [29]:
argentina_9252
Out[29]:
COUNTRY geometry
10 Argentina MULTIPOLYGON (((2319238.057 5961851.998, 23223...
InĀ [30]:
argentina_9252.boundary
Out[30]:
10    MULTILINESTRING ((2319238.057 5961851.998, 232...
dtype: geometry
InĀ [31]:
argentina_9252.boundary.plot()
Out[31]:
<Axes: >
No description has been provided for this image
InĀ [32]:
type(argentina_9252.boundary)
Out[32]:
geopandas.geoseries.GeoSeries
InĀ [33]:
argentina_9252.boundary.to_frame()
Out[33]:
0
10 MULTILINESTRING ((2319238.057 5961851.998, 232...
InĀ [34]:
argentina_border=argentina_9252.boundary.to_frame()

argentina_border['name']='Argentina'

argentina_border.rename(columns={0:'geometry'},inplace=True)

argentina_border = argentina_border.set_geometry("geometry")

argentina_border.crs
Out[34]:
<Projected CRS: EPSG:9252>
Name: MMN / Argentina 2
Axis Info [cartesian]:
- X[north]: Northing (metre)
- Y[east]: Easting (metre)
Area of Use:
- name: Argentina - Tierra del Fuego onshore.
- bounds: (-68.64, -55.11, -63.73, -52.59)
Coordinate Operation:
- name: Argentina zone 2
- method: Transverse Mercator
Datum: Ministerio de Marina Norte
- Ellipsoid: International 1924
- Prime Meridian: Greenwich
InĀ [35]:
#Exercise 5
InĀ [36]:
argentina_states=gpd.read_file("https://github.com/Luis9193/geodf_operations/raw/main/maps/arg_admbnda_adm1_unhcr2017.shp")
argentina_municipalities=gpd.read_file("https://github.com/Luis9193/geodf_operations/raw/main/maps/arg_admbnda_adm2_unhcr2017.shp")
InĀ [37]:
type(argentina_states), type(argentina_municipalities)
Out[37]:
(geopandas.geodataframe.GeoDataFrame, geopandas.geodataframe.GeoDataFrame)
InĀ [38]:
argentina_states.geometry.head()
Out[38]:
0    MULTIPOLYGON Z (((-6918884.037 -4931769.351 0....
1    POLYGON Z ((-7566501.154 -2903626.584 0.000, -...
2    POLYGON Z ((-6929548.312 -2770568.731 0.000, -...
3    MULTIPOLYGON Z (((-7424844.932 -5660565.812 0....
4    POLYGON Z ((-6507173.600 -4100891.637 0.000, -...
Name: geometry, dtype: geometry
InĀ [39]:
argentina_municipalities.geometry.head()
Out[39]:
0    POLYGON Z ((-66.53119 -28.53104 0.00000, -66.5...
1    POLYGON Z ((-60.16947 -38.17843 0.00000, -60.0...
2    POLYGON Z ((-65.26270 -24.31436 0.00000, -65.2...
3    POLYGON Z ((-56.90895 -37.18880 0.00000, -56.9...
4    POLYGON Z ((-61.98441 -34.51765 0.00000, -61.8...
Name: geometry, dtype: geometry
InĀ [40]:
argentina_states.crs
Out[40]:
<Projected CRS: EPSG:3857>
Name: WGS 84 / Pseudo-Mercator
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: World between 85.06°S and 85.06°N.
- bounds: (-180.0, -85.06, 180.0, 85.06)
Coordinate Operation:
- name: Popular Visualisation Pseudo-Mercator
- method: Popular Visualisation Pseudo Mercator
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
InĀ [41]:
argentina_municipalities.crs
Out[41]:
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
InĀ [42]:
argentina_states=argentina_states.to_crs(9252)
argentina_municipalities=argentina_municipalities.to_crs(9252)
InĀ [43]:
#Exercise 6
InĀ [44]:
argentina_municipalities.plot(facecolor='lightgrey', edgecolor='black',linewidth=0.2)
Out[44]:
<Axes: >
No description has been provided for this image
InĀ [45]:
argentina_municipalities.head()
Out[45]:
ADM0_ES ADM0_PCODE ADM1_ES ADM1_PCODE ADM2_ES ADM2_REF ADM2_PCODE geometry
0 Argentina AR La Rioja AR046 Arauco Arauco AR046007 POLYGON Z ((2741643.797 6842320.077 0.000, 274...
1 Argentina AR Buenos Aires AR006 Tres Arroyos Tres Arroyos AR006833 POLYGON Z ((3274415.472 5737734.786 0.000, 328...
2 Argentina AR Jujuy AR038 El Carmen El Carmen AR038014 POLYGON Z ((2879495.127 7306897.453 0.000, 287...
3 Argentina AR Buenos Aires AR006 Pinamar Pinamar AR006644 POLYGON Z ((3575679.580 5815434.698 0.000, 357...
4 Argentina AR Buenos Aires AR006 General Pinto General Pinto AR006351 POLYGON Z ((3144724.317 6158577.347 0.000, 315...
InĀ [46]:
argentina_municipalities.ADM1_ES.value_counts()
Out[46]:
ADM1_ES
Buenos Aires              135
Santiago del Estero        27
Córdoba                    26
Corrientes                 25
Chaco                      25
Salta                      23
La Pampa                   22
Santa Fe                   19
San Juan                   19
La Rioja                   18
Mendoza                    18
Entre RĆ­os                 17
Misiones                   17
TucumƔn                    17
Catamarca                  16
NeuquƩn                    16
Jujuy                      16
Chubut                     15
Ciudad de Buenos Aires     15
RĆ­o negro                  13
San Luis                    9
Formosa                     9
Santa Cruz                  7
Tierra del Fuego            2
Name: count, dtype: int64
InĀ [47]:
argentina_municipalities[argentina_municipalities.ADM1_ES=='Buenos Aires'].plot()
Out[47]:
<Axes: >
No description has been provided for this image
InĀ [48]:
argentina_municipalities[argentina_municipalities.ADM1_ES=='Buenos Aires'].unary_union
Out[48]:
No description has been provided for this image
InĀ [49]:
BuenosAires_union=argentina_municipalities[argentina_municipalities.ADM1_ES=='Buenos Aires'].unary_union
InĀ [50]:
type(BuenosAires_union)
Out[50]:
shapely.geometry.multipolygon.MultiPolygon
InĀ [51]:
gpd.GeoDataFrame(index=[0],data={'ADM':'Buenos Aires'},
                 crs=argentina_municipalities.crs,
                 geometry=[BuenosAires_union])
Out[51]:
ADM geometry
0 Buenos Aires MULTIPOLYGON Z (((3079143.360 5498808.279 0.00...
InĀ [52]:
#Con dissolve
argentina_municipalities[argentina_municipalities.ADM1_ES=='Buenos Aires'].dissolve().plot()
Out[52]:
<Axes: >
No description has been provided for this image
InĀ [53]:
BuenosAires_dissolve=argentina_municipalities[argentina_municipalities.ADM1_ES=='Buenos Aires'].dissolve()
type(BuenosAires_dissolve)
Out[53]:
geopandas.geodataframe.GeoDataFrame
InĀ [54]:
#Exercise 7
InĀ [55]:
airports_9252
Out[55]:
name kind latitude_deg longitude_deg elevation_ft region_name municipality geometry
0 Minister Pistarini International Airport large_airport -34.822200 -58.535800 67.0 Buenos Aires Province Buenos Aires (Ezeiza) POINT (3459143.742 6096878.264)
1 Jorge Newbery Airpark large_airport -34.559200 -58.415600 18.0 Buenos Aires (Autonomous City) Buenos Aires POINT (3473326.500 6125055.331)
2 Malvinas Argentinas Airport medium_airport -54.843300 -68.295800 102.0 Tierra del Fuego Province Ushuaia POINT (2545204.629 3922073.788)
3 El Calafate - Commander Armando Tola Internati... medium_airport -50.280300 -72.053101 669.0 Santa Cruz Province El Calafate POINT (2282364.042 4425601.501)
4 Cataratas Del IguazĆŗ International Airport medium_airport -25.737301 -54.473400 916.0 Misiones Province Puerto Iguazu POINT (3967392.078 7072420.841)
... ... ... ... ... ... ... ... ...
938 Agrodistribuidora Airstrip closed -29.220089 -61.760298 220.0 Santa Fe Province Tostado POINT (3204887.574 6746621.896)
939 Dayry Partners Americas Manufacturing Argentin... heliport -32.440000 -63.228900 639.0 Córdoba Province Villa Nueva POINT (3043070.390 6396750.732)
940 Villa Unión Airport closed -29.422180 -62.789526 248.0 Santiago del Estero Province Villa Unión POINT (3103251.602 6729935.094)
941 Roca Heliport heliport -32.060000 -64.779400 3444.0 Córdoba Province Yacanto de Calamuchita POINT (2898684.357 6445788.634)
942 Austral S.A. Heliport heliport -52.738600 -68.572500 290.0 Tierra del Fuego Province Yacimiento Cañadón Alfa POINT (2528839.013 4156471.091)

943 rows Ɨ 8 columns

InĀ [56]:
airports_9252.kind.value_counts()
Out[56]:
kind
small_airport     687
heliport          144
medium_airport     68
closed             41
large_airport       2
balloonport         1
Name: count, dtype: int64
InĀ [57]:
medium_airport=airports_9252[airports_9252.kind=='medium_airport']
medium_airport.unary_union
Out[57]:
No description has been provided for this image
InĀ [58]:
medium_airport.unary_union.convex_hull
Out[58]:
No description has been provided for this image
InĀ [59]:
MediumAirport_hull= gpd.GeoDataFrame(index=[0],
                                    crs=medium_airport.crs,
                                    geometry=[medium_airport.unary_union.convex_hull])
MediumAirport_hull['name']='medium airports hull'

MediumAirport_hull
Out[59]:
geometry name
0 POLYGON ((2545204.629 3922073.788, 2282364.042... medium airports hull
InĀ [60]:
base=argentina_9252.plot(facecolor='yellow')
medium_airport.plot(ax=base)
MediumAirport_hull.plot(ax=base,facecolor='green',
                       edgecolor='white',alpha=0.4,
                       hatch='X')
Out[60]:
<Axes: >
No description has been provided for this image
InĀ [61]:
#Exercise 8
InĀ [62]:
centroidX,centroidY=argentina_9252.centroid.x.values[0],argentina_9252.centroid.y.values[0]

MunisN_argentina=argentina_municipalities.cx[:,centroidY:]
MunisS_argentina=argentina_municipalities.cx[:,:centroidY]
MunisW_argentina=argentina_municipalities.cx[:centroidX,:]
MunisE_argentina=argentina_municipalities.cx[centroidX:,:]
InĀ [63]:
base=MunisN_argentina.plot(facecolor='yellow', edgecolor='black',linewidth=0.2, alpha=0.6)
MunisS_argentina.plot(facecolor='grey', edgecolor='black',linewidth=0.2,ax=base, alpha=0.4)
Out[63]:
<Axes: >
No description has been provided for this image
InĀ [64]:
munisNS_argentina=MunisN_argentina.overlay(MunisS_argentina, how="intersection",keep_geom_type=True)
munisNS_argentina.plot()
Out[64]:
<Axes: >
No description has been provided for this image
InĀ [65]:
MunisN_argentina.overlay(MunisS_argentina, how="symmetric_difference",keep_geom_type=False).plot()
Out[65]:
<Axes: >
No description has been provided for this image